import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BookCateVO, BookCateForm, BookCateQuery } from '@/api/market/bookCate/types';

/**
 * 查询预约分类列表
 * @param query
 * @returns {*}
 */

export const listBookCate = (query?: BookCateQuery): AxiosPromise<BookCateVO[]> => {
  return request({
    url: '/market/bookCate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询预约分类详细
 * @param id
 */
export const getBookCate = (id: string | number): AxiosPromise<BookCateVO> => {
  return request({
    url: '/market/bookCate/' + id,
    method: 'get'
  });
};

/**
 * 新增预约分类
 * @param data
 */
export const addBookCate = (data: BookCateForm) => {
  return request({
    url: '/market/bookCate',
    method: 'post',
    data: data
  });
};

/**
 * 修改预约分类
 * @param data
 */
export const updateBookCate = (data: BookCateForm) => {
  return request({
    url: '/market/bookCate',
    method: 'put',
    data: data
  });
};

/**
 * 删除预约分类
 * @param id
 */
export const delBookCate = (id: string | number | Array<string | number>) => {
  return request({
    url: '/market/bookCate/' + id,
    method: 'delete'
  });
};
